//
//  TTRequestQueue.swift
//  TianTianBiTing
//
//  Created by Gox mac 2 on 2018/12/28.
//  Copyright © 2018 Gox_WallyDiao. All rights reserved.
//

import UIKit

class TTRequestQueue: NSObject {
    fileprivate var list:[Any] = [Any]()
    fileprivate var active:Bool = true
    
    override init() {
        super.init()
    }
}

//  MARK: - ###### 公有方法 ######
extension TTRequestQueue {
    
    func intoQueue(_ obj : Any) {
        self.list.append(obj)
    }
    
    func intoQueueFirst(_ obj : Any) {
        self.list.insert(obj, at: 0)
    }
    
    func outQueue() -> Any?{
        guard self.list.count > 0 else {
            return nil
        }
        let obj:Any? = self.list.first
        self.list.removeFirst()
        return obj
    }
    
    func setActive(_ active:Bool)  {
        self.active = active
    }
    
    func getActive() -> Bool{
        return self.active
    }
    
    func count() -> Int {
        return self.list.count
    }
    
}
